package common.components
{
	import mx.controls.DataGrid;
	import mx.controls.Label;
	import mx.controls.dataGridClasses.DataGridListData;
	
	public class StatusRenderer extends Label
	{
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight); 
			var fillColor:uint = 0x000000;
		    var grid1:DataGrid = DataGrid(DataGridListData(listData).owner);
			var cellValue:Object = data[DataGridListData(listData).dataField];
			if (cellValue == "OPEN")
				cellValue = "300";
			else if (cellValue == "IN PROCESS")
				cellValue = "400";
			else if (cellValue == "CLOSED")
				cellValue = "900";
		    
		    switch(Number(cellValue)){
		    	case 100:
		    	{
		    		//this.setStyle("color","#00FF00");
		    		fillColor = 0xCCFFFF;
		    		break;
		    	}
		    	case 200:
				case 201:
		    	{
		    		//this.setStyle("color","#00CC00");
		    		fillColor = 0xCCFF00;
		    		break;
		    	}
		    	case 300:
				case 301:
		    	{
		    		//this.setStyle("color","#009900");
		    		fillColor = 0x00CC00;
		    		break;
		    	}
				case 400:
				case 401:
				{
					//this.setStyle("color","#009900");
					fillColor = 0xFFFF00;
					break;
				}
				case 700:
				{
					//this.setStyle("color","#009900");
					fillColor = 0xFFCC00;
					break;
				}
		    	case 900:{
		    		//this.setStyle("color", "#006600");
		    		fillColor = 0xFF0000;
		    		break;
		    	}
		    }
		    
		    if (fillColor != 0x000000){
		    	this.graphics.clear();
			    this.graphics.beginFill(fillColor, 0.8);
			    this.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight + 2);
			    this.graphics.endFill();
			}
		} 

	}
}